package io;

import java.io.*;

/**
 * 字节缓冲输入流测试
 */
public class BufferedInputStreamTest {
    public static void main(String[] args) {
        read();
    }

    private static void read() {
        try (
                BufferedInputStream bis = new BufferedInputStream(new FileInputStream("/Users/luchuan/IdeaProjects/java-test/a.txt"))
        ) {
            final byte[] bytes = new byte[1024];
            int len;
            if ((len = bis.read(bytes)) != -1) {
                System.out.println(new String(bytes,0,len));
            }
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }


    }
}
